#!/usr/bin/env python3

class Student:
    def __init__(self, name, age):
        self.name = name
        self.age = age

    def __add__(self, o):
        return self.age + o

    def __radd__(self, o):
        return self.age + o

    def __iadd__(self, o):
        self.age += o.age
        return self

    def __sub__(self, o):
        return self.age - o.age

    def __getitem__(self, index):
        return index

    def __setitem__(self, index, value):
        print("setitem: ", index, value)
        return index

    def __call__(self, s):
        print("call: ", s)

def main():
    s = Student("张三", 20)
    b = Student("李三", 25)

    print(s.age, b.age)
    s += b
    print(s + b.age)
    print(s - b)

    print(30 + s)

    print(s[0], s[1])
    s[0] = 10

    s("hello")


if __name__ == "__main__":
    main()
